<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <!-- 编写一个函数，计算两个数字的和、积 要求：使用传参的形式 function test(a,b,type){ -->
        <script>
            function sum(a,b,type){
             
var a=a||0;
var b=b||0;
if(type=="*"){
    num=a*b;
    console.log("两个数字的积是",num);
} if(type==="+"){
    num=a+b;
    console.log("两个数字的和是",num);
}


            }sum(1,3,"*")
        </script>
</body>
</html>